{include file="pageheader_erp.htm"}

{insert_scripts files="../js/jquery.1.3.2.js"}

<style type="text/css">
	#outside_container
	{
		width:100%;
		border:none;
		overflow:hidden;
		text-align:center;
		padding:10px;
		background-color:#F4FAFB;
	}
	#inner_container
	{
		width:45%;
		border:1px solid #DDD;
		overflow:hidden;
		text-align:left;
		background-color:#DDEEF2;
		margin:0 auto;
	}

	
	#inner_container table tr td
	{
		padding:6px;
		font-weight:bold;
		background-color:#FFF;
	}
	
	.tb_lable
	{
		padding-left:20px;
		
	}

</style>


 <!-- start goods list -->
<div class="main-div">
	<div id="outside_container">
		<div id="inner_container">
			<form name="add_supplier_group"  id="add_supplier_group"  action="javascript:;"  onsubmit="javascript:addSupplierGroup(this);" method="post">
				<table>
					<tr>
						<td width="150"><span class="tb_lable">{$lang.erp_supplier_group_name}：</span></td>
						<td><input name="group_name" id="group_name" type="text" value="{$supplier_group.group_name}" size="30" /></td>
						<td><span style="color:red;font-weight:normal;">{$lang.erp_required_item}</span></td>
					</tr>
					<tr>
						<td><span class="tb_lable">{$lang.erp_admin}：</span></td>
						<td>
							{if $admins}
							<select id="group_admin" name="group_admin" >
								{foreach from=$admins item=admin}
									<option value='{$admin.user_id}' {if $supplier_group.admin_id eq $admin.user_id}selected='selected'{/if}>{$admin.user_name}</option>
								{/foreach}
							</select>
							{/if}
						</td>
						<td><span>&nbsp;</span></td>
					</tr>
					<tr>
						<td><span class="tb_lable">{$lang.erp_is_valid}：</span></td>
						<td>
							<select id="is_valid" name="is_valid" >
									<option value='0' {if $supplier_group.is_valid eq 0}selected="selected"{/if} >{$lang.no}</option>
									<option value='1' {if $supplier_group.is_valid eq 1}selected="selected"{/if}>{$lang.yes}</option>
							</select>
						</td>
						<td><span>&nbsp;</span></td>
					</tr>					
					<tr><td  colspan="3" align="center"><input type="image" src="./images/submit.gif" style="cursor:pointer;" /></td></tr>																									
				</table>
				<input name="group_id" id="group_id" value="{$supplier_group.group_id}" style="display:none;">
			</form>
		</div>
	</div>
</div>
<!-- end goods list -->

{literal}
<script language="JavaScript">
   
   function addSupplierGroupResponse(res){
   	 window.document.location="./erp_supplier_group.php?act=list";
   }
    function addSupplierGroup()
	{
		var group_id=$("#group_id").attr('value');
		var group_name=$("#group_name").attr('value');
		var group_admin=$("#group_admin").attr('value');
		var is_valid=$("#is_valid").attr('value');
		
		if(group_name=="")
		{
			alert('{$lang.erp_supplier_group_name_required}');
			return;
		}		

		Ajax.call('erp_supplier_group.php?act=save_supplier_group', 'group_id='+group_id+'&group_name='+group_name+'&group_admin='+ group_admin+'&is_valid='+is_valid, addSupplierGroupResponse, 'POST', 'JSON');
		
		}   
</script>
{/literal}
{include file="pagefooter.htm"}

